﻿using System;
using System.Collections.Generic;

namespace Mbs
{
    /// <summary>
    /// 监听管理器接口
    /// </summary>
    /// <typeparam name="TListner">监听器类型</typeparam>
    /// <remarks>观察者模式中的抽象主题角色</remarks>
    public interface IListnerManager<TListner>:IDisposable,IEnumerable<TListner>
        where TListner:IListner
    {
        /// <summary>
        /// 注册监听器
        /// </summary>
        /// <param name="Listners">监听器集合</param>
        void Register(params TListner[] listners);
        /// <summary>
        /// 注销监听器
        /// </summary>
        /// <param name="Listners">监听器集合</param>
        void UnRegister(params TListner[] listners);

        /// <summary>
        /// 监听器数量
        /// </summary>
        int Count { get; }

        void Clear();
    }

    public interface IListnerManager<TListner, TEnum> : IDisposable,IEnumerable<TListner>
        where TListner : IListner<TEnum>
    {
        /// <summary>
        /// 注册监听器
        /// </summary>
        /// <param name="Listners">监听器集合</param>
        void Register(params TListner[] listners);
        /// <summary>
        /// 注销监听器
        /// </summary>
        /// <param name="Listners">监听器集合</param>
        void UnRegister(params TListner[] listners);

        void Clear();
    }
}